package test;


import java.util.List;

import javax.annotation.Resource;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.fuxian.model.Teacherlessons;
import com.fuxian.service.TeacherLessonService;
import com.fuxian.util.DateUtile;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:beans.xml")
public class TeacherLessonServiceImpl {

	@Resource
	private TeacherLessonService service;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testAddTeacherLesson() {
		Teacherlessons tls = new Teacherlessons();
		tls.setLesson_id(1);
		tls.setTeacher_id(1);
		tls.setCreate_time(DateUtile.getTimestamp());
		tls.setCreate_user("fuxian");
		service.addTeacherLesson(tls);
	}

	//@Test
	public void testDeleteTeacherLessonById() {
		service.deleteTeacherLessonById(1,1);
	}

	@Test
	public void testModifyTeacherLesson() {
		Teacherlessons tls = new Teacherlessons();
		tls.setLesson_id(1);
		tls.setTeacher_id(1);
		tls.setCreate_time(DateUtile.getTimestamp());
		tls.setCreate_user("fuxian333");
		service.modifyTeacherLesson(tls);
	}

	@Test
	public void testSelectAllTeacherLessons() {
		List<Teacherlessons> list = service.selectAllTeacherLessons(1, 10);
		for (Teacherlessons teacherlessons : list) {
			System.out.println(teacherlessons.getTeacher_id() + ":"
					+ teacherlessons.getLesson_id());
		}
	}

}
